import sys

from qtpy.QtGui import QImage, QImageReader
from qtpy.QtCore import Qt, QUrl
from qtpy.QtWidgets import QApplication, QWidget, QVBoxLayout

from qfluentwidgets_expand import ShadowImageLabel, ShadowCenterImageLabel, EditableImageLabel


class Demo(QWidget):
    def __init__(self):
        super().__init__()
        self.vertical_layout = QVBoxLayout(self)
        # image = QImage('./resources/scaled.jpg')
        # image.bytesPerLine()
        for i in range(1):
            image_label = ShadowCenterImageLabel(self)
            image_label.setBorderRadius(8, 8, 8, 8)
            image_label.setUrl(QUrl('https://api.zzzmh.cn/v2/bz/v3/getUrl/37aa5dc36d88444786b6b543845963ba20'))
            image_label.setFixedSize(300, 200)
            self.vertical_layout.addWidget(image_label)
        self.resize(800, 600)


if __name__ == '__main__':
    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    app = QApplication(sys.argv)
    demo = Demo()
    demo.show()
    sys.exit(app.exec_())
